#include <iostream>
#define SIZE 50

using namespace std;

int numbers[SIZE], n = 5;

int gcm(int, int);

int main()
{
	int i, p;
	for (i = 1, p = 0; i <= n; ++i, p += 2)
	{	
		cout << "number: ";
		cin >> numbers[p];
		numbers[p - 1] = gcm(numbers[p - 2], numbers[p]);
	}
	for (i = 0; i < p - 1; ++i)
		cout << numbers[i] << endl;
	
	return 0;
}

int gcm(int a, int b)
{
	int i, temp, g;
	if (a < b)
	{
		temp = a;
		a = b;
		b = temp;
	}
	for (i = 1; i <= a; ++i)
		if (a % i == 0 && b % i == 0)
			g = i;
	
	return g;
	
}